package router

import (
	"github.com/gin-gonic/gin"
	"goCmdb/internal/service"
	"net/http"
)

func NewRouter() *gin.Engine {
	gin.SetMode(gin.DebugMode)
	r := gin.Default()

	r.StaticFS("/static", http.Dir("./dist"))
	apiv1 := r.Group("/api/v1")
	apiv1.Use() //middleware.JWT()
	{
		apiv1.POST("/AssetInventory/add", service.AssetAdd)
		apiv1.POST("/AssetInventory/delete", service.AssetDelete)
		apiv1.POST("/AssetInventory/update", service.AssetUpdate)
		apiv1.GET("/AssetInventory/get", service.AssetGet)

		apiv1.POST("/ServiceInventory/add", service.ServiceAdd)
		apiv1.POST("/ServiceInventory/delete", service.ServiceDelete)
		apiv1.POST("/ServiceInventory/update", service.ServiceUpdate)
		apiv1.GET("/ServiceInventory/get", service.ServiceGet)

	}

	return r
}